/**
 * @file main.c
 * @brief Main Loop
 *
 * @author mzg
 * @date 2015-01-27
 * @version rxSys.main.01
 */
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "device.h"
#include "resource.h"
#include "console.h"
#include "config.h"
#include "key.h"

int no_pcikey(void) {return 0;}

extern void cmd_mode(int can_quit);
extern void show_self_check(void);
extern void board_mode(void);
extern int sys_param_init(void);
extern int set_running_status( int pci, int res);
extern int is_cfg_security(void);
extern void gprs_test(void);
extern void icc_test(void);
 int pcikey_init(void)	__attribute__ ((weak, alias("no_pcikey")));
 
#define RESOURCE_INIT_PASS	(0)
extern volatile uint32_t gsystem_running_status;

 int main(void)
 {
 	 int pci = 0;
	 int ret;
	 
	 char key;
	 device_init();
	 set_console("/dev/ser1");
	 printf("%s %s\n", __DATE__, __TIME__);

    show_self_check();
    buzzer_start();
    mdelay(40);
    buzzer_stop();

    lcd_set_font(DISP_FONT_24);
    title_disp_state_init();
    sys_param_init(); 
    pci = pcikey_init();
	 prn_init();
	 prn_set_grey(40);	
	 if (resource_init() == RESOURCE_INIT_PASS) {
	 
#ifndef CONFIG_SECURITY_NO
		 if (is_cfg_security()) {
			 if (pci) cmd_mode(0);
		 } 
#endif
    	board_mode();
	 } 
	 else {
         printf("fadfd test\n");
		 cmd_mode(0);
	 } 
	 return 0;
 }
